Repository navigation
Conversation
winsmith
force-pushed
the
claude/fervent-fermi-ftauy2
branch
2 times, most recently
from
September 22, 2026 13:00
209c906 to
cc8b77e
Compare
Send a second signal per page load, `TelemetryDeck.Web.pageLeave`, the first time the page is hidden or unloaded. It carries the maximum scroll depth reached (percent), a 25/50/75/100 milestone bucket and the number of seconds the page was visible, as `TelemetryDeck.PageEngagement.*` parameters. The signal shares `url` and `referrer` with the pageview. The signal is sent with `navigator.sendBeacon` as a plain-text body (no CORS preflight, so it survives unload), falling back to a keepalive fetch. Tracking is on by default and can be disabled with `data-page-engagement="false"`. To make room for this, the entry module is split into `config.mjs` (script-tag attributes, test-mode detection), `send.mjs` (body builder, fetch and beacon transports) and `page-engagement.mjs` (measurement). The pageview request itself is unchanged. Tests cover the new signal, the short-page case, the opt-out and that only one signal is sent even though both visibilitychange and pagehide fire. Also fixes the referrer fixture, which loaded a non-existent unminified bundle, and the duplicated empty-app-id test. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BjanDUedGAKE6LDgN8Eo5h
All three workflows failed before running a command: setup-node@v2's pnpm cache hit the retired cache API, upload-artifact@v3 is refused by GitHub, and pnpm 6.19 cannot read the pnpm 8 lockfile in this repo. Bump checkout, setup-node and upload-artifact to v4, use pnpm 8 and Node 20 in ci.yml, deploy.yml and release.yml. Also add a test that loads the SDK with `async`, which the README now recommends, and format the README snippets. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BjanDUedGAKE6LDgN8Eo5h
WebKit measured 49% where Chromium and Firefox measured 50% for a scroll of exactly one viewport on a four-viewport page, because of sub-pixel layout differences and the heading's default margin. Scroll 1.2 viewports instead (55%) and zero the fixture margins so the milestone assertion no longer sits on a rounding edge. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BjanDUedGAKE6LDgN8Eo5h
winsmith
force-pushed
the
claude/fervent-fermi-ftauy2
branch
from
September 22, 2026 13:17
cc8b77e to
b3dfcbf
Compare
The generated stub left package-ecosystem empty, which Dependabot rejects. Watch the npm ecosystem, which also covers the pnpm lockfile, and the GitHub Actions used in the workflows. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds page engagement tracking to the TelemetryDeck Web SDK, enabling measurement of user interaction with pages through scroll depth and time spent viewing.
Key Changes
New
pageLeavesignal: Sends aTelemetryDeck.Web.pageLeaveevent when a page is hidden or unloaded, capturing:scrollDepth: Deepest point of the page viewed (0-100%)scrollDepthMilestone: Highest milestone reached (0, 25, 50, 75, or 100)engagedSeconds: Time the page was visible in the foregroundRefactored signal sending: Extracted common signal building logic into
send.mjswith:buildBody(): Constructs signal payload with app ID, URL, referrer, locale, and versionsend(): Standard fetch-based signal sendingsendBeacon(): Usesnavigator.sendBeacon()for reliable delivery during page unloadNew configuration module (
config.mjs): Centralizes script attribute parsing and initialization logic, including:data-page-engagement="false"Page engagement tracking (
page-engagement.mjs): Implements scroll depth measurement and dwell time tracking with:requestAnimationFramevisibilitychangeandpagehideeventsUpdated tests: Comprehensive test coverage for:
Documentation: Added README section explaining the new signals, parameters, and example analytics query
Implementation Details
data-page-engagement="false"pageLeavesignal usessendBeacon()to ensure delivery even during page unloadvisibilitychangeandpagehideevents are handled, but the signal is sent only once per page loadhttps://claude.ai/code/session_01BjanDUedGAKE6LDgN8Eo5h